package com.chapter8.example2;

public class Test {
    public static void main(String[] args) {
        //简单工厂模式。增加一个类，首先需要该类继承LeiFeng，然后修改SimpleFactory,最后修改客户端
        final LeiFeng student = SimpleFactory.createLeiFeng("学雷锋的大学生");
        student.BuyRice();

        //工厂方法模式。增加一个类，首先需要该类继承LeiFeng,然后增加该类的工厂实现IFactory接口，最后修改客户端
        final UndergraduateFactory undergraduateFactory = new UndergraduateFactory();
        final LeiFeng leiFeng = undergraduateFactory.createLeiFeng();
        leiFeng.BuyRice();


    }
}
